<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.weifly.jettycn.JettycnUtil" %>
<%@ page import="com.weifly.jettycn.domain.Project" %>
<%@ page import="com.weifly.jettycn.util.PageInfo" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%
	PageInfo proPageInfo = (PageInfo)request.getAttribute("proPageInfo");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>project列表</title>
    <%@include file="/comhead.jsp" %>
    <script type="text/javascript">
	function deleteProjectHandler(dm){
		var pid = $(dm).attr("projectid");
		var sure = confirm("你确定要删除这个项目？");
		if(sure){
			$.ajax({
				url: "deleteProject.do",
				data: {
					projectid: pid
				},
				success: function(data, textStatus){
					data = $.parseJSON(data);
					if(data.success){
						alert("删除成功！");
						window.location.reload();
					}else{
						alert("删除失败！");
					}
				}
			});
		}
	}
    
    $(document).ready(function(){
		
	});
    </script>
  </head>
  <body>
    <a href="addProject.do">添加项目</a>
<%
	JettycnUtil.outPagebar(request, out, proPageInfo, "/console/project/projectList.do", new HashMap<String, String>());
%>
    <table class="table_show1" border="1px" bordercolor="#ccbbaa">
      <thead>
        <tr>
          <td>项目名称</td>
          <td>主页地址</td>
          <td>作者</td>
          <td>分类</td>
          <td>更新日期</td>
          <td>操作</td>
        </tr>
      </thead>
      <tbody>
<%
	List dataList = proPageInfo.getDataList();
	for(int i=0;i<dataList.size();i++){
		Project pro = (Project)dataList.get(i);
%>
        <tr>
          <td><%=pro.getName()%></td>
          <td><%=pro.getHomepage()%></td>
          <td><%=pro.getAuthor()%></td>
          <td><%=JettycnUtil.translateCatalog(pro.getCatalogid())%></td>
          <td><%=JettycnUtil.formatDateTime(pro.getUpdate()) %></td>
          <td>
            <a href="editProject.do?project=<%=pro.getPrjid()%>">编辑</a>&nbsp;
            <a href="releaseList.do?project=<%=pro.getPrjid()%>">版本</a>&nbsp;
            <a href="###" onclick="deleteProjectHandler(this);" projectid="<%=pro.getPrjid()%>">删除</a>
          </td>
        </tr>
<%
	}
%>
      </tbody>
    </table>
<%
	JettycnUtil.outPagebar(request, out, proPageInfo, "/console/project/projectList.do", new HashMap<String, String>());
%>
  </body>
</html>